/*
 * @Author: shiguo
 * @Date: 2022-04-19 10:23:01
 * @LastEditors: shiguo
 * @LastEditTime: 2023-03-10 14:05:17
 * @FilePath: /@aks-dev/easyui/jsbridge/RNEasyui.ts
 */

import { Dimensions, NativeModules, Platform } from 'react-native';

const { RNEasyui } = NativeModules;



export const getDeviceBrand = () => RNEasyui.getDeviceBrand();



export const getStatusBarHeight = () => {
    if (Platform.OS == 'android') return RNEasyui.getStatusBarHeight();

    const deviceHeight = Dimensions.get('window').height;
    const isiPhoneX = Platform.OS == 'ios' && (deviceHeight > 736)
    if (isiPhoneX) return Promise.resolve(44)
    return Promise.resolve(20)
}

export const getNavigationBarHeight = () => {
    if (Platform.OS == 'android') return RNEasyui.getNavigationBarHeight();

    return Promise.resolve(44)

}


export const gotoDesktop = () => {
    if (Platform.OS == 'android') RNEasyui?.gotoDesktop();
}




